<?php

use App\Api\AuthController;
use App\Api\ConfigController;
use App\Api\LoginController;
use App\Api\SwiperController;
use App\Api\TradeController;
use App\Api\UserController;
use App\Api\VoucherController;

//客户端登录
Route::post('mini/clientlogin', [LoginController::class, 'clientLogin']);
Route::post('mini/clientlogout', [LoginController::class, 'clientLogout']);
//用户注册
Route::post('mini/register', [AuthController::class, 'register']);
Route::group(['prefix' => 'mini/', 'as' => 'mini.', 'middleware' => 'auth:sanctum'], function () {
    //获取二维码并出示(商户出示二维码)
    Route::post('trade/voucher/{voucher}/showQr', [TradeController::class, 'showQr'])->name('showQr');
    //扫码发送请求（获赠者扫码获取url连接获取卡券）
    Route::post('trade/voucher/{voucher}/send', [TradeController::class, 'send'])->name('send');
    //验证页面
    Route::get('trade/voucher/{voucher}/verify', [TradeController::class, 'verify'])->name('verify');
    //当前用户
//所有代金券

    Route::get("voucher", [VoucherController::class, 'index']);


    Route::get('user/{user}/voucher', [VoucherController::class, 'userHasVouchers']);

    Route::get('user/info', [UserController::class, 'info']);
    //普通用户
    Route::get('normal', [UserController::class, 'normal']);
    //联盟会员
    Route::get('member', [UserController::class, 'member']);
    //幻灯片
    Route::resource('swiper', SwiperController::class);

    //系统信息
    Route::get('config', [ConfigController::class, 'info']);

    //用户注册


});
